package cn.ronghuanet.base.exception;

/**
 * 自定义异常类,后端需要返回预知的业务异常时,就使用这个异常类
 */
public class BusinessException extends RuntimeException{

    private Integer code;

    public BusinessException() {
    }

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public BusinessException(ResponseCode responseCode) {
        super(responseCode.getMessage());
        this.code = responseCode.getCode();
    }

    public Integer getCode() {
        return code;
    }
}
